home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d902.lha / Less / Less.doc < prev    next >
Text File  |  1993-08-26  |  22KB  |  522 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. _l_e_s_s - _o_p_p_o_s_i_t_e _o_f _m_o_r_e
  8.  
  9. Version 1.6Z July 18, 1993
  10.  
  11. Versions since Amiga version 1.3Z are supported by
  12.  
  13. Raymond L. Zarling,
  14. Department of Computer Science
  15. Calif. State Univ. Stanislaus
  16. Turlock, CA 95380
  17.  
  18. rayz@csustan.EDU
  19.  
  20.  
  21. _l_e_s_s [-_d_s_t_w_c_C_e_E_m_M_q_Q_u_U] [-_h_N] [-b[fp]_N] [-x_N] [-[z]_N]
  22.      [-_P[_m_M]_s_t_r_i_n_g] [+_c_m_d]  [_f_i_l_e_n_a_m_e]...
  23.  
  24. _L_e_s_s is a program similar to  _m_o_r_e  (1),  but  which  allows
  25. backwards  movement in the file as well as forward movement.
  26. Also, _l_e_s_s does not have  to  read  the  entire  input  file
  27. before starting, so with large input files it starts up fas-
  28. ter than most text editors.
  29.  
  30.      Commands are based on _m_o_r_e,  _v_i and _e_m_a_c_s.   Commands  may
  31. be  preceeded  by a decimal number, called N in the descrip-
  32. tions below.  The number is used by some commands, as  indi-
  33. cated.
  34.  
  35.  
  36. _I_n _t_h_e _f_o_l_l_o_w_i_n_g _d_e_s_c_r_i_p_t_i_o_n_s, ^_X _m_e_a_n_s _c_o_n_t_r_o_l-_X.
  37.  
  38. H or Help key
  39.      Help: display a summary of these commands.  If you for-
  40.      get all the other commands, remember this one.
  41.  
  42.  
  43. SPACE
  44.      Scroll forward N lines, default one window (see  option
  45.      -z below).  If N is more than the screen size, only the
  46.      final screenful is displayed.
  47.  
  48.  
  49. f or ^F
  50.      Same as SPACE.
  51.  
  52.  
  53. ^V
  54.      Same as SPACE.
  55.  
  56.  
  57. b or ^B
  58.      Scroll backward N lines, default one window (see option
  59.      -z below).  If N is more than the screen size, only the
  60.      final screenful is displayed.
  61.  
  62.  
  63. RETURN
  64.      Scroll forward N lines, default 1.  The entire N lines
  65.      are displayed, even if N is more than the screen size.
  66.  
  67.  
  68. e or ^E
  69.      Same as RETURN.
  70.  
  71. ^N
  72.      Same as RETURN.
  73.  
  74.  
  75. j or ^J
  76.      Also the same as RETURN.
  77.  
  78. y or ^Y
  79.      Scroll backward N lines, default 1.  The entire N lines
  80.      are displayed, even if N is more than the screen size.
  81.  
  82. k or ^K
  83.      Same as y.
  84.  
  85. ^P
  86.      Same as y.
  87.  
  88.  
  89. d or ^D
  90.      Scroll forward N lines, default half of the screen.  If
  91.      N is specified, it becomes the new default for subsequent
  92.      d and u commands.  The half-screen default is set again
  93.      whenever the screen is resized.
  94.  
  95.  
  96. u or ^U
  97.      Scroll backward N lines, default half of the screen.  If
  98.      N is specified, it becomes the new default for subsequent
  99.      d and u commands.  The half-screen default is set again
  100.      whenever the screen is resized.
  101.  
  102.  
  103. r or ^R or ^L
  104.      Repaint the screen.
  105.  
  106.  
  107. R    Repaint the  screen,  discarding  any  buffered  input.
  108.      Useful  if  the  file  is  changing  while  it is being
  109.      viewed.
  110.  
  111.  
  112. g    Go to line N in  the  file,  default  1  (beginning  of
  113.      file).  (Warning: this may be slow if N is large.)
  114.  
  115. <    Same as g.
  116.  
  117.  
  118. G    Go to line N in the file, default the end of the  file.
  119.      (Warning:  this  may  be slow if standard input, rather
  120.      than a file, is being read.)
  121.  
  122. >    Same as G.
  123.  
  124.  
  125. p    Go to a position N percent into the file.  N should  be
  126.      between 0 and 100.  (This is possible if standard input
  127.      is being read, but only if _l_e_s_s has already read to the
  128.      end  of  the  file.   It is always fast, but not always
  129.      useful.)
  130.  
  131.  
  132. %    Same as p.
  133.  
  134.  
  135. m    Followed by any lowercase  letter,  marks  the  current
  136.      position with that letter.
  137.  
  138.  
  139. '    (Single  quote.)  Followed  by  any  lowercase  letter,
  140.      returns  to  the  position  which was previously marked
  141.      with that letter.  Followed by  another  single  quote,
  142.      returns  to the postion at which the last "large" move-
  143.      ment command was executed.  All marks are lost  when  a
  144.      new file is examined.
  145.  
  146.  
  147. /pattern
  148.      Search forward in the file for the N-th line containing
  149.      the  pattern.  N defaults to 1.  The pattern is a regu-
  150.      lar expression, as recognized by Unix _e_d (see the
  151.      section on regular expressions below).  The search starts
  152.      at  the  second  line displayed (but see the -t option,
  153.      which changes this).  If the pattern is omitted, search
  154.      for another occurance of the most recent pattern.
  155.  
  156. ^S   Same as /.
  157.  
  158.  
  159. ?pattern
  160.      Search backward in the file for the N-th line  contain-
  161.      ing the pattern.  The search starts at the line immedi-
  162.      ately before the top line displayed.  If the pattern is
  163.      omitted, search for another occurance of the most recent
  164.      pattern.
  165.  
  166.  
  167. n    Repeat previous search, for N-th  line  containing  the
  168.      last pattern, searching in the same direction as the
  169.      previous search.
  170.  
  171.  
  172. E    Examine a new file.  If the filename  is  missing,  the
  173.      "current"  file  (see  the N and P commands below) from
  174.      the list of files in the command line  is  re-examined.
  175.      If  the  filename  is  a pound sign (#), the previously
  176.      examined file is re-examined (one level of backup only).
  177.  
  178.  
  179. N    Examine the next file (from the list of files given  in
  180.      the  command line).  If a number N is specified (not to
  181.      be confused with the command N), the N-th next file  is
  182.      examined.
  183.  
  184.  
  185. P    Examine the previous file.  If a number N is specified,
  186.      the N-th previous file is examined.
  187.  
  188.  
  189. = or ^G
  190.      Prints some information about the  file  being  viewed,
  191.      including  its  name  and the byte offset of the bottom
  192.      line being displayed.  If possible, it also prints  the
  193.      length  of  the  file and the percent of the file above
  194.      the last displayed line.
  195.  
  196.  
  197. -    Followed by one of the command line option letters (see
  198.      below), this will toggle the setting of that option
  199.      and/or print a message describing the new setting.  Not
  200.      all options can be set from within the program:  b, P,
  201.      and window sizing are command-line only options.
  202.  
  203. +cmd Causes the specified cmd to be executed each time a new
  204.      file  is examined.  For example, +G causes _l_e_s_s to ini-
  205.      tially display each file starting  at  the  end  rather
  206.      than the beginning.
  207.  
  208.  
  209. V    Prints the version number of _l_e_s_s being run.
  210.  
  211.  
  212. q    Exits _l_e_s_s.
  213.  
  214.  
  215. _C_o_m_m_a_n_d _l_i_n_e _o_p_t_i_o_n_s _a_r_e _d_e_s_c_r_i_b_e_d _b_e_l_o_w.  _M_o_s_t _o_p_t_i_o_n_s  _m_a_y
  216. _b_e _c_h_a_n_g_e_d _w_h_i_l_e _l_e_s_s is running, via the "-" command.
  217.  
  218.      Options are also taken from  the  environment  variable
  219. "LESS".   For  example, if you like very verbose prompting, to
  220. avoid typing "less -M ..." each time _l_e_s_s  is  invoked,  you
  221. might tell _c_s_h or the AmigaDOS shell:
  222.  
  223. setenv LESS M
  224.  
  225. or if you use _S_K_s_h:
  226.  
  227. LESS=M; export LESS
  228.  
  229. The environment variable is parsed before the command  line,
  230. so  command line options override the LESS environment vari-
  231. able.  A dollar sign ($) may be used to signal the end of an
  232. option  string.   This is important only for options like -P
  233. which take a following string.
  234.  
  235. Some options have values, some are 2-way toggles, and some are
  236. 3-way toggles.  The 3-way ones are handled by using both an
  237. upper-case and a lower-case option name.  Usually, the upper-
  238. case option is the most extreme, the lower-case setting is
  239. moderate, and neither is least extreme.  For instance, the
  240. -m and -M options control the length of the prompt line.  If
  241. -M is in effect, you get a relatively long prompt, while -m
  242. is much shorter.  If neither -m nor -M is set, the prompt is
  243. a single ":" character (unless you redefine one or more of
  244. these using -P).  To change a 3-way option, use either -x or
  245. -X, where x is the option name.  Typing -x will establish the
  246. moderate case if it wasn't already set (i.e. either -X or
  247. neither was in effect) or set the least extreme ("neither")
  248. choice if it was.  Similarly, -X would establish the X option
  249. if it wasn't already in effect; otherwise "neither".
  250.  
  251. -b   Numeric; set from command line or environment only.
  252.      The -b_n option tells _l_e_s_s to use a non-standard  buffer
  253.      size.   There  are two standard (default) buffer sizes,
  254.      one is used when a file is being  read  and  the  other
  255.      when  a  pipe  (standard  input)  is  being  read.  The
  256.      current defaults are 5 buffers for  files  and  12  for
  257.      pipes.   (Buffers  are 1024 bytes.) The number _n speci-
  258.      fies a different number of buffers to use.  The -b  may
  259.      be followed by "f", in which case only the file default
  260.      is changed, or by "p"  in  which  case  only  the  pipe
  261.      default is changed.  Otherwise, both are changed.  This
  262.      option cannot be reset using the '-' command from within
  263.      Less.
  264.      These default settings are pretty minimal, designed for
  265.      situations where memory is really at a premium.  (A full
  266.      page of text on a high-res screen can be nearly 4k.)  If
  267.      you have enough memory, you may want to use an environment
  268.      variable to revise them upward;  I use -bf15bp100.
  269.  
  270. -c and -C  3-way switch
  271.      If the -c option is set, when _l_e_s_s needs to change the
  272.      entire  display,  it will paint from the top line down.
  273.      Otherwise, it will repaint  the  screen  by  scrolling
  274.      from  the  bottom  of  the screen.
  275.      The -C option is like -c, but  the  screen  is  cleared
  276.      before it is repainted.  This is the fastest option, and
  277.      is the default upon program startup.
  278.      The -c or -C option may be overridden for backward file
  279.      motion by a sufficiently large setting of -h.  If -h is
  280.      set larger than the screen size, full page backwards
  281.      movements will scroll regardless of the -C setting.
  282.  
  283. -e and -E  3-way switch
  284.      Under -e, the only way to exit less is via the "q"  com-
  285.      mand, or the screen close gadget.  Without the -e option,
  286.      less automatically exits if you use a page forward com-
  287.      mand when you have already reached end-of-file (default).
  288.      The -E flag causes less  to  exit if you use any of the
  289.      usual commands (not just page forward) after you have
  290.      reached end-of-file.
  291.      Regardless of the setting of this switch, Less will quit
  292.      immediately upon receipt of a BREAK signal.  BREAK may
  293.      be generated by the AmigaDOS "break" command directed at
  294.      the Less process, or by a ^C in the invoking CLI window
  295.      (if there is one).  A ^C in the Less window is ignored,
  296.      with a warning message.
  297.  
  298. -f     Toggle
  299.      Use -f if you wish any ^M characters in the input to be
  300.      displayed.  These would be present if the text being viewed
  301.      came from an MSDOS system or other source that leaves
  302.      them at the end of each line.  Turned off by default.
  303.      (Used to be the "assume clean" flag under unix.)
  304.  
  305. -h   Numeric
  306.      The -h option interacts with -c to specify under what
  307.      conditions backwards scrolling will be used to update a
  308.      display.  The -h setting is the maximum number of lines
  309.      to scroll  backwards.  If  it  is necessary  to move
  310.      backwards more than this many lines, or more than one
  311.      screenful, the screen is repainted in a forward  direction.
  312.      Backwards movements of exactly one screenful are handled
  313.      according to the -c setting, if the user leaves -h unset.
  314.      If -h is left unspecified by the user, it defaults to one
  315.      less than the screen size.  Once the user specifies a
  316.      value, however, that value is retained for the balance of
  317.      the run.  Use -h0 to disable all backwards scrolling.
  318.  
  319. -m and -M  3-way switch
  320.      By default, _l_e_s_s prompts verbosely (-m), with the
  321.      percent into the file. The -M option causes _l_e_s_s to
  322.      prompt even more verbosely than -m.  If neither -m nor
  323.      -M is set, the prompt is very short.  Note that Less
  324.      automatically shortens any prompt if the screen is not
  325.      wide enough.
  326.  
  327. -P   String; command line or environment only
  328.      The -P option provides a way to tailor the three prompt
  329.      styles  to your own preference.  You would normally put
  330.      this option in your LESS environment  variable,  rather
  331.      than type it in with each less command.  Such an option
  332.      must either be the last option in the LESS variable, or
  333.      be  terminated  by  a  dollar  sign.   -P followed by a
  334.      string changes  the  default  (short)  prompt  to  that
  335.      string.   -Pm  changes  the  medium  (-m) prompt to the
  336.      string, and -PM changes  the  long  (-M)  prompt.   The
  337.      string  consists  of  a  sequence  of letters which are
  338.      replaced with certain predefined strings, as follows:
  339.           Ffile name
  340.           ffile name, only once
  341.           Ofile n of n
  342.           ofile n of n, only once
  343.           bbyte offset
  344.           ppercent into file
  345.           Ppercent if known, else byte offset
  346.      Angle brackets, < and >, may  be  used  to  surround  a
  347.      literal  string  to  be  included  in  the prompt.  The
  348.      defaults are "fo" for the short prompt, "foP"  for  the
  349.      medium prompt, and "Fobp" for the long prompt.
  350.      Example: Setting your LESS variable  to  "PmFOP$PMFObp"
  351.      would  change  the  medium  and  long prompts to always
  352.      include the file name and "file n of n" message.
  353.      Another example: Setting your LESS variable to
  354.      "mPm<--Less-->FoPe" would change the medium  prompt  to
  355.      the  string  "--Less--"  followed  by the file name and
  356.      percent into the file.   It  also  selects  the  medium
  357.      prompt  as  the  default  prompt  (because of the first
  358.      "m").
  359.  
  360. -q and -Q  3-way switch
  361.      Normally, if an attempt is made to scroll past the  end
  362.      of  the  file  or before the beginning of the file, the
  363.      screen flashes ("visual bell") to indicate this  fact.
  364.      The  -q option  tells  _l_e_s_s not to flash the screen at
  365.      such times.
  366.      Even if -q is given, _l_e_s_s will flash the screen on certain
  367.      other errors, such as typing an invalid character.  The
  368.      -Q option tells _l_e_s_s to be quiet all the time; that is,
  369.      never  do the visual bell.
  370.  
  371. -s   2-way switch
  372.      The -s option causes  consecutive  blank  lines  to  be
  373.      squeezed into a single blank line.  This is useful when
  374.      viewing _n_r_o_f_f output.
  375.  
  376. -t   2-way switch
  377.      Normally, forward searches start  just  after  the  top
  378.      displayed line (that is, at the second displayed line).
  379.      Thus forward searches include the  currently  displayed
  380.      screen.  The -t option causes forward searches to start
  381.      just after the bottom line displayed, thus skipping the
  382.      currently displayed screen.
  383.  
  384. -u and -U  3-way switch
  385.      If the -u option is given, backspaces  are  treated  as
  386.      printable  characters;  that  is,  they are sent to the
  387.      terminal when they appear in the input.
  388.      If the -U option is given, backspaces  are  printed  as
  389.      the two character sequence "^H".
  390.      If neither -u nor -U is given, backspaces which  appear
  391.      adjacent  to  an  underscore character are treated spe-
  392.      cially: the underlined  text  is  displayed  using  the
  393.      terminal's   hardware  underlining  capability.   Also,
  394.      backspaces which appear between two  identical  charac-
  395.      ters  are  treated  specially:  the  overstruck text is
  396.      printed using the terminal's hardware boldface capabil-
  397.      ity.   Other  backspaces  are  deleted,  along with the
  398.      preceeding character.  This is the default setting.
  399.      The recognition of ANSI escape sequences is also controlled
  400.      by this switch.  The ANSI underlining, boldface, italic,
  401.      and inverse rendering is only done if neither -u nor -U
  402.      is set.
  403.  
  404. -w   2-way switch
  405.      Normally, _l_e_s_s uses  a  tilde  character  to  represent
  406.      lines  past  the end of the file.  The -w option causes
  407.      blank lines to be used instead.
  408.  
  409. -x   Numeric
  410.      The -x_n option sets tab stops every _n  positions.   The
  411.      default for _n is 8.
  412.  
  413. -[z] Numeric
  414.      When given a backwards or forwards window command, _l_e_s_s
  415.      will  by  default  scroll  backwards  or  forwards  one
  416.      screenful of lines. The -z_n option changes the  default
  417.      scrolling window size to _n lines, or one  screenful,
  418.      whichever is smaller.  Note  that the "z" is optional for
  419.      compatibility with _m_o_r_e.  If the screen is resized
  420.      so that the -z option would be larger than a screenful,
  421.      -z is reset to this smaller screen size.  If the screen
  422.      is then enlarged to a size greater than -z, the previously
  423.      specified value is restored.
  424.  
  425. +    String
  426.      If a command line option begins with +,  the  remainder
  427.      of  that  option  is  taken to be an initial command to
  428.      _l_e_s_s.  For example, +G tells _l_e_s_s to start at  the  end
  429.      of  the file rather than the beginning, and +/xyz tells
  430.      it to start at the first  occurence  of  "xyz"  in  the
  431.      file.    As   a   special  case,  +<number>  acts  like
  432.      +<number>g; that is,  it  starts  the  display  at  the
  433.      specified  line  number  (however, see the caveat under
  434.      the "g" command above).  If the option starts with  ++,
  435.      the initial command applies to every file being viewed,
  436.      not just the first one.  The + command described previ-
  437.      ously  may  also  be used to set (or change) an initial
  438.      command for every file.
  439.  
  440. -[N,N,N,N] or [cli]
  441.      If an option of this form appears on the command line,
  442.      Less uses the information to size and position its display
  443.      window.  The second ([cli]) form means that Less should
  444.      not open a new window, but use the cli window from which
  445.      it was launched instead.  This specification is simply
  446.      ignored if Less was not launched from a cli.  The first
  447.      ([N,N,N,N]) form is used to specify the size and position
  448.      of a new output window to be created.  Any of the four
  449.      values may be omitted, defaulting to 0, and any of the
  450.      four may be of the form w, w+N, or w-N.  In this case, the
  451.      character "w" is replaced by the corresponding dimension
  452.      of the existing cli window, so the new window can open
  453.      in a position and/or size relative to the launching cli.
  454.      If one or more of the last values is omitted, the
  455.      trailing commas may be omitted also.  A value of zero in
  456.      either of the last two positions causes Less to use maximum
  457.      screen dimensions.  The four values indicate in order the
  458.      left edge, top edge, width, and height of window to use.
  459.      If any of these are negative, they are taken as relative
  460.      to the bottom right corner of the workbench screen.  Thus,
  461.      -[0,12,,-100] will open a full-width window extending from
  462.      12 pixels from the top to 100 pixels from the bottom of
  463.      the screen. Similarly, -[-400,0,400,0] would open a full-
  464.      height window which is flush against the right edge of the
  465.      screen and 400 pixels wide.  And -[w+10,w+12,w,w] would
  466.      open a window the same size as the existing cli window
  467.      but offset slightly to the right and down.  In all cases,
  468.      if the window specified would fall off an edge of the
  469.      screen, or would go less than a certain minimum size, the
  470.      window is silently coerced back into conformity.
  471.  
  472. _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g
  473.  
  474. Less uses Regular Expressions, in the style of Unix 'ed', for
  475. specifying searches.  While these expressions can appear quite
  476. cryptic, they are very powerful tools for locating text within
  477. a document.
  478.  
  479. Any pattern consisting only of letters, numbers, and spaces will
  480. simply search for the given pattern.  But you can use one or
  481. more of the metacharacters [].^$()|*+ to engineer very
  482. sophisticated searches.  The '.' stands for any single character,
  483. and 'x*' stands for 0 or more occurances of x (so 'x.*y' would
  484. match anything that started with x and ended with y).  'x+'
  485. works the same way, for 1 or more occurances of x.  'x?' matches
  486. 0 or 1 occurances of x (i.e. 'x' or nothing).  '[abc]' matches
  487. any single occurance of 'a', 'b', or 'c'.  '[^abc]' matches any
  488. single character except 'a', 'b', or 'c'.  '[a-m]' matches any
  489. single character in the range 'a' through 'm' inclusive.  '^x'
  490. finds x only at the beginning of a line; 'x$' only at the end of
  491. a line.  'x|y' matches either x or y.  The various pieces can be
  492. combined, of course, and grouped with parentheses.  For instance,
  493. '([Aa]ny|[Ee]ach) +of you' would find any phrase beginning with
  494. 'any' or 'each' (possibly capitalized) followed by one or more
  495. blanks, followed by 'of you'. ' (can)?not ' matches either 'not'
  496. or 'cannot', but not 'nothing' or 'cancel'.  '[^a-zA-Z]i[^a-zA-Z]'
  497. finds all occurances of a variable 'i' in a program, but does not
  498. find 'i' embedded in other variable names or words.  To match a
  499. metacharacter literally, precede it with a backslash; e.g. '\.  \*'
  500. would match a period followed by two spaces and an asterisk.
  501.  
  502.  
  503. _O_t_h_e_r _C_o_n_s_i_d_e_r_a_t_i_o_n_s
  504.  
  505. Less is residentable, so if you use it a lot you may wish to add
  506. it to your system resident list.  To do this, make sure the pure
  507. bit is set in the file protection codes (protect +p Less).  Then
  508. add the line "resident c:Less" (or whatever your path is) to your
  509. startup-sequence.
  510.  
  511. Less uses internally Ascii characters 0 and 129-136.  Since these
  512. are non-printing characters, it shouldn't make any difference
  513. under normal circumstances.  Character 0 will display as '@' and
  514. 129-136 as ^?.
  515.  
  516.  
  517. _W_h_e_n _u_s_e_d _o_n _s_t_a_n_d_a_r_d _i_n_p_u_t (_r_a_t_h_e_r _t_h_a_n _a  _f_i_l_e),  _y_o_u  _c_a_n
  518. _m_o_v_e  _b_a_c_k_w_a_r_d_s  _o_n_l_y _a _f_i_n_i_t_e _a_m_o_u_n_t, _c_o_r_r_e_s_p_o_n_d_i_n_g _t_o _t_h_a_t
  519. _p_o_r_t_i_o_n _o_f _t_h_e _f_i_l_e _w_h_i_c_h _i_s _s_t_i_l_l _b_u_f_f_e_r_e_d.  _T_h_e -_b  _o_p_t_i_o_n
  520. _m_a_y _b_e _u_s_e_d _t_o _e_x_p_a_n_d _t_h_e _b_u_f_f_e_r _s_p_a_c_e.
  521.  
  522.